﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="adminlist.aspx.cs" MasterPageFile="~/Site.master" Inherits="codelist" %>

    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <div style="width: 571px; " class="liststly">
  
    <asp:Label runat=server BackColor="Aqua" Font-Bold="True" Height="25px" 
            style="margin-top: 0px; text-align:center" Width="570px">用户管理</asp:Label>
    <asp:GridView ID="gv_admin" runat="server" AutoGenerateColumns="False" CellPadding="4"

                        ForeColor="#333333" 
             DataKeyNames="iAdmin_ID" 
            DataSourceID="SqlDataSource1"  ShowFooter ="True" GridLines="None" Width="572px" 
            >

                        <EditRowStyle BackColor="#2461BF" />

                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

                        <AlternatingRowStyle BackColor="White" />

                        <Columns>

                            

                            <asp:BoundField DataField="sName" HeaderText="用户名" SortExpression="sName">
                            <ItemStyle Width="200px" HorizontalAlign="Center"/>
                            </asp:BoundField>
                            <asp:BoundField DataField="sPassword" HeaderText="密码" 
                                SortExpression="sPassword">
                            <ItemStyle Width="250px" HorizontalAlign="Center"/>
                            </asp:BoundField>
                            <asp:BoundField DataField="sRole" HeaderText="权限">
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:CommandField ShowDeleteButton="True"  HeaderText="操作"/>

                        </Columns>

                        <RowStyle BackColor="#EFF3FB" />

                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />

                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />

                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />

                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:DevMgmntConnectionString %>" 
            SelectCommand="SELECT * FROM [t_admin]" 
            DeleteCommand="DELETE FROM [t_admin] WHERE [iAdmin_ID] = @iAdmin_ID" 
            
            UpdateCommand="UPDATE [t_admin] SET [sName] = @sName, [sPassword] = @sPassword WHERE [iAdmin_ID] = @iAdmin_ID" 
            InsertCommand="INSERT INTO [t_admin] ([sName], [sPassword]) VALUES (@sName, @sPassword)">
                        <DeleteParameters>
                            <asp:Parameter Name="iAdmin_ID" Type="Int32" />
                        </DeleteParameters>
          
                        <InsertParameters>
                            <asp:Parameter Name="sName" Type="String" />
                            <asp:Parameter Name="sPassword" Type="String" />
                        </InsertParameters>
          
                        <UpdateParameters>
                            <asp:Parameter Name="sName" Type="String" />
                            <asp:Parameter Name="sPassword" Type="String" />
                            <asp:Parameter Name="iAdmin_ID" Type="Int32" />
                        </UpdateParameters>
        </asp:SqlDataSource>

        <asp:Panel ID="Panel1" runat="server" Width="570px">
            <asp:Label ID="Label1" runat="server" Text="用户名："></asp:Label>
            <asp:TextBox ID="tx_adminID" runat="server"></asp:TextBox>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Label ID="Label2" runat="server" Text="密码："></asp:Label>
            <asp:TextBox ID="tx_adminName" runat="server"></asp:TextBox>
             &nbsp;&nbsp;&nbsp;&nbsp;
             <asp:Label ID="Label3" runat="server" Text="权限："></asp:Label>
            <asp:DropDownList ID="sel_role" runat="server">
            <asp:ListItem Value="普通用户">普通用户</asp:ListItem>
             <asp:ListItem Value="系统管理">系统管理</asp:ListItem>
             <asp:ListItem Value="档案管理">档案管理</asp:ListItem>
            </asp:DropDownList>
             <br />
             <br />
             <center>
            <asp:Button ID="bt_adminAdd" runat="server" onclick="bt_adminAdd_Click" 
                Text="添加" />
                </center>
        </asp:Panel>
                    
    </div>
    </asp:Content>
 
